package com.geek.javase.ch08.video.exceptionss;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/*
 *@author wangpeng
 *2025/10/16 21:26
 *@description TODO
 */
public class ExceptionDemo {
    public static void main(String[] args) throws ParseException {
        String str = "2025-10-15 12:12:12";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //在编译期间，可能会发生时间格式解析异常，则需要抛出ParseException解决
        Date date = sdf.parse(str);
        System.out.println(date);
    }

}






/*
//在运行期间  抛出数学异常 ArithmeticException: / by zero
int i = 10/0;
        System.out.println("i = "+i);


//在运行期间  抛出空指针异常 NullPointerException
//String s = null;
//System.out.println(s.length());*/
